package example.demo.consumer;

import com.rabbitmq.client.Channel;
import example.demo.config.ConfirmConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 接受消息-- 确认发布模式
 */
@Component
@Slf4j
public class Consumer {

    // 接受消息
    @RabbitListener(queues = ConfirmConfig.CONFIRM_QUEUE_NAME)
    public void receiveConfirmMessage(Message message, Channel channel) {
        String msg = new String(message.getBody());
        log.info("接受到的队列 confirm queue 消息：{}",msg);
    }
}
